﻿package  
{
	import com.ixiyou.net.Cache;
	import com.ixiyou.net.CacheLoader;
	import flash.display.DisplayObject;
	import flash.display.Loader;
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.events.HTTPStatusEvent;
	import flash.net.URLLoader;
	import flash.net.URLLoaderDataFormat;
	import flash.net.URLRequest;
	import flash.utils.ByteArray;
	
	/**
	 * ...
	 * @author magic
	 */
	public class TestCache extends Sprite
	{
		private var cacheLoader:CacheLoader;
		public function TestCache() 
		{
			
			var cache:Cache = new Cache("ix");
			cacheLoader = new CacheLoader(cache);
			cacheLoader.addEventListener(Event.COMPLETE, complete);
			cacheLoader.dataFormat = URLLoaderDataFormat.BINARY;
			cacheLoader.load(new URLRequest("test.jpg"));
		}
		private function complete(e:Event):void {
			var loader:Loader = new Loader();
			loader.loadBytes(cacheLoader.data);
			addChild(loader);
		}
	}
	
}